const {mergeSet,mergeSetWithEnd}=require('../lib/mergeSet');

const data={
    a:1,
    b:{
        c:2
    }
};
mergeSet(data,{
    'a.b':'a.b',
    'b.c':'b.c',
    'b.d':'b.d'
});


console.log(data);
const data1={
    a:1,
    b:{
        c:2
    }
};
mergeSet(data1,{
    b:{
        d:'b.d'
    },
    'b.e.m':'m',
    'b.e':{n:'n'}
});
console.log(data1);

const data2={
    seats:[
        {
            id:1,
            name:'1111'
        },
        {
            id:2,
            name:'222'
        }
    ]
};
//测试数组会不会bug
mergeSet(data2,{
    seats:[
        {
            id:3,
            name:'3333'
        }
    ]
});
console.log(data2);
mergeSet(data2,{
    'seats.$end':[
        {
            id:4,
            name:'4444'
        }
    ]
});
console.log(data2);
mergeSetWithEnd(data2,{
    'seats.$end':[
        {
            id:4,
            name:'4444'
        }
    ]
});
console.log(data2);